unit CategoryForm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, BaseSpecialForm, DB, ADODB, ImgList, ComCtrls, Grids, DBGrids,
  ToolWin, ExtCtrls, TreeDataHandle;

type
  TfrmCategory = class(TfrmSpecialForm)
    tvCategory: TTreeView;
    spl1: TSplitter;
    ilCategory: TImageList;
    procedure FormShow(Sender: TObject);
  private

    FTreeDataHandleClass: TTreeDataHandleClass;
    procedure SetTreeDataHandleClass(const Value: TTreeDataHandleClass);
    { Private declarations }
  protected
    procedure LoadCategory;
  public
    { Public declarations }
    property TreeDataHandleClass: TTreeDataHandleClass read FTreeDataHandleClass write SetTreeDataHandleClass;
  end;

var
  frmCategory: TfrmCategory;

implementation

uses AppADO;

{$R *.dfm}

procedure TfrmCategory.FormShow(Sender: TObject);
begin
  inherited;
  LoadCategory;
end;

procedure TfrmCategory.LoadCategory;
var
  aTreeDataHandle: TTreeDataHandle;
begin
  aTreeDataHandle := TTreeDataHandle.Create(GetADOConn());
  try
    aTreeDataHandle.LoadTreeData(tvCategory.Items);
  finally
    aTreeDataHandle.Free;
  end;
end;

procedure TfrmCategory.SetTreeDataHandleClass(
  const Value: TTreeDataHandleClass);
begin
  FTreeDataHandleClass := Value;
end;

end.
